package com.junxonline.instant.common.enumeration;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 终端指令枚举类
 *
 * @author JunX
 * @date 2021-11-16
 */
@Getter
@AllArgsConstructor
public enum TerminalCommandEnum {

    HEART_BEAT("心跳包", 0),
    AUTH("认证包", 1),
    SET_VOLUME("设置音量", 1000),
    SET_DISPLAY_TYPE("设置显示方式", 1001),
    QUERY_VOLUME("拉取音量", 2000),
    QUERY_DISPLAY_TYPE("拉取显示方式", 2001),
    PULL_SCREENSHOT("拉取截屏", 2012),
    ;

    /**
     * 标签
     */
    private final String label;

    /**
     * 值
     */
    private final Integer value;

    /**
     * 根据value获取枚举类对象
     *
     * @param value value
     * @return OperationEnum
     */
    public static TerminalCommandEnum getByValue(Integer value) {
        for (TerminalCommandEnum terminalCommandEnum : values()) {
            if (terminalCommandEnum.getValue().equals(value)) {
                return terminalCommandEnum;
            }
        }
        return null;
    }

    /**
     * 根据value获取枚举类对象的label
     *
     * @param value value
     * @return label
     */
    public static String valuesOf(Integer value) {
        for (TerminalCommandEnum terminalCommandEnum : values()) {
            if (terminalCommandEnum.getValue().equals(value)) {
                return terminalCommandEnum.getLabel();
            }
        }
        return null;
    }

}
